﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace BookMS
{
    public partial class admin22 : Form
    {
        Model.book m_binfo = new Model.book();
        BLL.Base xiugai = new BLL.Base();
        string ID = "";
        public admin22()
        {
            InitializeComponent();
        }
        public admin22(string id, string name, string author, string press, string number)
        {
            InitializeComponent();
            ID= textBox1.Text = id;
            textBox2.Text = name;
            textBox3.Text = author;
            textBox4.Text = press;
            textBox5.Text = number;
        }

        private void admin22_Load(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            //string sql = $"UPDATE book SET id='{textBox1.Text}',`name`='{textBox2.Text}',author='{textBox3.Text}',press='{textBox4.Text}',number='{textBox5.Text}'WHERE id='{ID}'";
            m_binfo.id = textBox1.Text.ToString();
            m_binfo.name = textBox2.Text.ToString();
            m_binfo.author = textBox3.Text.ToString();
            m_binfo.press = textBox4.Text.ToString();
            m_binfo.number = Convert.ToInt32(textBox5.Text.ToString());
            if (xiugai.xiugai(m_binfo) > 0)
            {
                MessageBox.Show("修改成功！");
                this.Close();
            }

        }
    }
}
